home *** CD-ROM | disk | FTP | other *** search
- //////////////////////////////////////////////////
- //
- // ADOBE SYSTEMS INCORPORATED
- // Copyright 2002 Adobe Systems Incorporated
- // All Rights Reserved
- //
- // NOTICE: Adobe permits you to use, modify, and
- // distribute this file in accordance with the terms
- // of the Adobe license agreement accompanying it.
- // If you have received this file from a source
- // other than Adobe, then your use, modification,
- // or distribution of it requires the prior
- // written permission of Adobe.
- //
- //////////////////////////////////////////////////
-
- //////////////////////////////////////////////////
- // Make Alias.js
- //
- // DESCRIPTION
- //
- // This script demonstrates the use of any functions of a class.
- // Here the method used is makeAlias which creates an alias of the
- // currently selected object. The advantage of using an alias is
- // that an alias exports as a single object with multiple references.
- //
- // HOW TO USE
- //
- // Create any object and select it in the Composition.
- // Select Scripts > Make Alias
- // Change the original or alias of the object and the
- // changes will be reflected in both of them.
- //
- //////////////////////////////////////////////////
-
- // Main Code [Execution of script begins from here]
-
- // Check if any composition is open
- if(application.compositions.length > 0){
- comp = application.currentComposition;
- if(comp.selection.length >= 1){ // Checks if at least one object is selected
- var targets = comp.selection; // Store all selected objects in the array targets
-
- // saves the current selection
- application.currentComposition.saveSelection();
- createAlias(targets);// Function createAlias called
-
- // restores the saved selection
- application.currentComposition.restoreSelection();
- }
- else{ // If no objects are selected brings the Console window up
- Console.show();
- // Writes to the Console
- Console.write("Please select the objects to make alias of and run script again.\n");
- }
- }
- else{// if no composition open
- // opens a new composition
- comp = application.newComposition();
- Console.show();
- Console.write("New Composition opened\nPlease create and select the objects to make alias of and run script again.\n");
- }
-
-
- // Add your own functions here
-
- //////////////////////////////////////////////////
- // createAlias:
- // Creates an alias of the objects passed to it
- //
- // The Alias will be created on top of the original object
- // Drag it away from the top and try to change it to see
- // changes reflected in both the source as well as target
-
- // source: The currently selected objects which are passed
- // to the function
- //////////////////////////////////////////////////
-
- function createAlias(source)
- {
- var aliases = new Array();// Array to store new alias
- for(var i=0; i < source.length ; i++) {
- aliases[i] = source[i].makeAlias();//method makeAlias creates the alias
- }
- }
-
-